package com.zlsy.learning.leetcode.arraycorrelation.array5428;

/**
 * @author zhouliang
 * @date 2020/06/07
 **/
public class Shuffle {

    public static int[] shuffle(int[] nums, int n) {
        int[] newnums = new int[nums.length];
        int index = 0;
        for (int i = 0; i < n; i++) {
            newnums[index++] = nums[i];
            newnums[index++] = nums[n + i];
        }
        return newnums;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{2, 5, 1, 3, 4, 7};
        int n = 3;
        int[] shuffle = shuffle(nums, n);
        System.out.println(shuffle);
    }
}
